<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<title>Registration</title>

<script type="text/javascript">
function validateForm()
{
	
var error="Error:\n"; 
var a=document.forms["form1"]["username"].value;
var b=document.forms["form1"]["password"].value;
var c=document.forms["form1"]["password2"].value;
var d=document.forms["form1"]["email"].value;
if (a==null || a==""||b==null || b==""||c==null || c==""||d==null || d=="")
  {
  error=error+"All fields must be filled out\n";
  }
  
else{
	if (b!=c){
		error=error+"Password must be same\n";
	}
  var atpos=d.indexOf("@");
  var dotpos=d.lastIndexOf(".");

  if (atpos<1 || dotpos<atpos+2 || dotpos+2>=d.length)
    {
    error = error+"Not a valid e-mail address\n";
    }

}
  if (error!="Error:\n"){
	  alert(error);
	  return false;
  }
}
  

</script>


</head>
<body>
	<%@ include file="header.html"%>
	<h3 align="Left">Registration</h3>

	<form id="form1" name="form1" method="post" action="Register"
		onsubmit="return validateForm();">
		<table border="0" align="center">
			<tr>
				<td>Username:</td>
				<td><input name="username" type="text" id="username" size="30"
					maxlength="20" />
				</td>
			</tr>
			<tr>
				<td>Password:</td>
				<td><input name="password" type="password" id="password"
					size="30" maxlength="30" />
				</td>
			</tr>

			<tr>
				<td>Confirm Password:</td>
				<td><input name="password2" type="password" id="password2"
					size="30" maxlength="30" />
				</td>
			</tr>
			<tr>
				<td>E-Mail:</td>
				<td><input name="email" type="text" id="email" size="30"
					maxlength="30" />
				</td>
			</tr>

			<tr>
				<td></td>
				<td><input type="submit" name="Submit" value="Submit" /> <input
					type="reset" name="Reset" value="Reset" />
				</td>
			</tr>
		</table>
	</form>


</body>
</html>